//
//  UIBarButtonItem+ImageItem.m
//  百思不得姐
//
//  Created by Lucky on 16/2/29.
//  Copyright © 2016年 Lucky. All rights reserved.
//

#import "UIBarButtonItem+ImageItem.h"

@implementation UIBarButtonItem (ImageItem)

+ (instancetype)itemWithImage:(UIImage *)image highLightedImage:(UIImage *)highLightedImage target:(id)target action:(SEL)action
{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setBackgroundImage:image forState:UIControlStateNormal];
    [button setBackgroundImage:highLightedImage forState:UIControlStateHighlighted];
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    button.size = button.currentBackgroundImage.size;
    return [[self alloc] initWithCustomView:button];
}

@end

